import React,{useEffect,useState} from 'react'

export default function MyTime() {
  const [count,setCount]=useState(0)
  useEffect(()=>{
    let timers=setInterval(() => {
        setCount(count=>count+1)
        console.log('---------------');
    }, 1000);
    return ()=>{
        clearInterval(timers)
    }
  },[])
  return (
    <div>
        <h1>{count}</h1>
    </div>  
  )
}
